<?xml version="1.0" encoding="UTF-8"?>
<!--
  Created by IntelliJ IDEA.
  User: lukman
  Date: 6/24/11
  Time: 11:54 AM
-->
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">

<head>
    <title>User</title>
</head>
<body>
<ui:composition template="/resources/template/yiiTwoColtemplate.xhtml">
    <ui:define name="contentpart">
        <div id="content">
            <p:panel header="Manage User" id="createPanel">
                <h:form id="tab">
                    <p:growl id="messages"/>
                    <p:dataTable id="tableform" paginator="true" rows="10" var="uzer"
                                 rowEditListener="#{anasitUserBean.onEditRow}"
                                 value="#{anasitUserBean.anasitUserList}"
                                 onRowSelectUpdate="display,messages"
                                 selection="#{anasitUserBean.selectedAnasitUser}" selectionMode="single"
                                 onRowSelectComplete="confirmation.show()"
                                 rowSelectListener="#{anasitUserBean.onRowSelect}"
                                 dblClickSelect="true">
                        <f:facet name="header">
                            List of registered Users
                        </f:facet>
                        <p:column sortBy="#{uzer.name.firstName}" filterBy="#{uzer.name.firstName}"
                                  headerText="#{msgs.firstName}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{uzer.name.firstName}"/>
                                </f:facet>
                                <f:facet name="input">
                                    <h:inputText value="#{uzer.name.firstName}"/>
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column sortBy="#{uzer.name.lastName}" filterBy="#{uzer.name.lastName}"
                                  headerText="#{msgs.lastName}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{uzer.name.lastName}"/>
                                </f:facet>
                                <f:facet name="input">
                                    <h:inputText value="#{uzer.name.lastName}"/>
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column sortBy="#{uzer.name.middleName}" filterBy="#{uzer.name.middleName}"
                                  headerText="#{msgs.middleName}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{uzer.name.middleName}"/>
                                </f:facet>
                                <f:facet name="input">
                                    <h:inputText value="#{uzer.name.middleName}"/>
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column headerText="Options">
                            <p:rowEditor/>
                        </p:column>

                    </p:dataTable>
                    <p:confirmDialog message="Please Confirm the user's details to delete" showEffect="bounce"
                                     hideEffect="explode" modal="true"
                                     header="Initiating Deletion" widgetVar="confirmation">

                        <h:panelGrid id="display" columns="2">
                            <h:outputText value="First Name:"/>
                            <h:outputText value="#{anasitUserBean.selectedAnasitUser.name.firstName}"/>

                            <h:outputText value="Last Name:"/>
                            <h:outputText value="#{anasitUserBean.selectedAnasitUser.name.lastName}"/>
                        </h:panelGrid>
                        <h:panelGroup>
                            <p:commandButton onclick="confirmation.hide()" value="Cancel"/>
                            <p:commandButton update="tableform" actionListener="#{anasitUserBean.deleteUser}"
                                             value="Delete User" oncomplete="confirmation.hide()"/>

                        </h:panelGroup>
                    </p:confirmDialog>
                </h:form>
            </p:panel>
        </div>
    </ui:define>
    <ui:define name="operationspart">
        <h:form>
            <p:menu>
                <p:submenu label="User Operations">
                    <p:menuitem value="View all Users" url="users.xhtml"/>
                    <p:menuitem value="Create User" url="create.xhtml"/>
                </p:submenu>
            </p:menu>
        </h:form>
    </ui:define>
</ui:composition>
</body>

</html>